//
//  Person.m
//  数据存储
//
//  Created by song on 15/1/24.
//  Copyright (c) 2015年 song. All rights reserved.
//

#import "Person.h"

@implementation Person


- (void)encodeWithCoder:(NSCoder *)coder
{
    
    [coder encodeObject:_name forKey:@"name"];
    [coder encodeInt:_age forKey:@"age"];
}

-(instancetype)initWithCoder:(NSCoder *)aDecoder
{
    if(self = [super init])
    {
        _name =[aDecoder decodeObjectForKey:@"name"];
        _age = [aDecoder decodeIntForKey:@"age"];

    }
    return self;
   }

-(NSString *)description
{
    return [NSString stringWithFormat:@"name is %@ and age is %d" ,_name , _age];
}
@end
